#ifndef __M_MENU_H__
#define __M_MENU_H__

enum MenuEntryTypes
{
    MENU_ENTRY_TYPE_TEXT,
    MENU_ENTRY_TYPE_MENU,
    MENU_ENTRY_TYPE_OPTION_STR,
    MENU_ENTRY_TYPE_OPTION_INT,
    MENU_ENTRY_TYPE_OPTION_CONTROL,
    MENU_ENTRY_TYPE_OPTION_CORE,
    MENU_ENTRY_TYPE_CALLBACK,
};

typedef struct
{
    char *desc;
    int enable;
    int type;
    void *option;
} MenuEntry;

typedef struct
{
    char *desc;
    int16_t core_key;
    int selected;
} KeyMapEntry;

typedef struct
{
    uint32_t *value;
    char **descs;
    int n_options;
} StrOptionValue;

typedef struct
{
    uint32_t *value;
    int min;
    int max;
} IntOptionValue;

typedef struct
{
    uint32_t *value;
    uint32_t local_key;
    char desc[256];
} ControlOptionValue;

typedef struct
{
    char *key;
    char **values;
    char **labels;
    char *default_value;
    int n_options;
    int pos;
} CoreOptionValue;

void initMenuDrawInfo();

int enterMenu();
int exitMenu();

void ctrlMenu();
void drawMenu();

int isMenuNeedRefresh();
void setMenuNeedRefresh(int enable);

int makeSaveScreenshotPath(char *path);

int saveScreenshotToPath(const char *path);

int resetSettingConfig();
int resetMiscConfig();
int resetGraphicsConfig();
int resetControlConfig();
#if defined(WSC_BUILD)
int resetControlConfigV();
#endif
int resetCoreConfig();

void refreshMenuEntriesInfo();

MenuEntry *getCurrentMenuEntries();

void setMainCoreEntiesEnable(int enable);
int isMainCoreEntiesEnable();
void setCoreEntiesInfo(MenuEntry *entries, int n_entries, int enable);
int getCoreEntiesLength();

extern float MENU_FREE_DRAW_WIDTH, MENU_FREE_DRAW_HEIGHT;
extern float MENU_FREE_DRAW_SX, MENU_FREE_DRAW_SY, MENU_FREE_DRAW_DX, MENU_FREE_DRAW_DY;

extern MenuEntry control_entries[];
extern MenuEntry *core_entries;

#endif
